﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterPage.Master"
    Inherits="System.Web.Mvc.ViewPage<PagingDto>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        using (Html.BeginForm("List", "Channel", FormMethod.Post, new {id = "pagingForm"}))
        {%>
    <div class="iLocation">
        当前位置：站点前台数据 &raquo; 站点频道管理
    </div>
    <div class="content">
        <h1>
            频道列表：</h1>
        <table id="tableInfo" class="listTable marT">
            <tr class="tr2">
                <th class="smallTd">
                    <a href="#">
                        <input type="checkbox" name="checkbox3" />
                    </a>
                </th>
                <th>
                    频道名称
                </th>
                <th>
                    使用模板
                </th>
                <th>
                    频道标识
                </th>
                <th>
                    创建时间
                </th>
                <th>
                    当前状态
                </th>
                <th class="alignR">
                    操作
                </th>
            </tr>
            <%
            foreach (SiteChannelDto dto in Model)
            {%>
            <tr class="tr2">
                <td>
                    <input type="checkbox" name="SelectInfoIds" value="<%=dto.ChannelId%>" />
                </td>
                <td>
                    <%=dto.ChannelName%>
                </td>
                <td>
                    &nbsp;<%=dto.ChannelTemplateId%>
                </td>
                <td>
                    &nbsp;<%=dto.ChannelCode%>
                </td>
                <td>
                    &nbsp;<%=dto.ChannelTime%>
                </td>
                <td>
                    &nbsp;<%=dto.ChannelCurState == 1 ? "正常" : "关闭"%>
                </td>
                <td class="alignR">
                    <%=Html.ActionLink("编辑", "Edit", new {controller = "Channel", id = dto.ChannelId})%>
                    |
                    <%=Html.ActionLink("关闭", "Close", new {controller = "Channel", id = dto.ChannelId},
                                                  new {onclick = "return confirm('确定要关闭该频道吗');"})%>
                </td>
            </tr>
            <%
            }%>
        </table>
        <div class="pageBar">
            <%
            Html.RenderPartial("Paging", Model);%>
        </div>
        <div class="toolbar">
            <input type="checkbox" name="checkbox" id="CheckAll" />
            全选
            <input type="button" value="删除" onclick="DeleteInfos();" />
        </div>
    </div>
    <%
        }%>
    <script type="text/javascript">
        $("#CheckAll").click(function () {
            var objs = $("#tableInfo input");
            for (var i = 0; i < objs.length; i++) {
                if ($(this).attr("checked") == true) {
                    objs.attr("checked", "checked");
                }
                else {
                    objs.attr("checked", "");
                }
            }
        });

        function DeleteInfos() {
            $("#pagingForm").attr("action", "/Admin/DeleteAdmin");
            $("#pagingForm").submit();
        }
    </script>
</asp:Content>
